//this sample show howto get position from GPS device on aliyun OS.
var callbackEventManager=new CallbackEventManager(CloudAPI.Device.DeviceStateInfo.getCurrentPosition);
function MapGetPositionResponse(fSuccess,eventInfo) {
	if(fSuccess){
		var position=eventInfo;
		// position.coords.latitude : 纬度
		// position.coords.longitude : 经度
		// position.coords.accuracy : 精度
		// position.address.city : 城市名
		window.my_map.centerAndZoom(new AliLatLng(position.coords.latitude ,position.coords.longitude),15);
		CloudAPI.Utility.toast("江湖传言你现身"+(position.address.city?position.address.city:"此地"));
		//window.my_map.setCenter("39.90364,116.4121,16");
		//console.debug(position.coords.latitude + ","+ position.coords.longitude + ",16");
	}else{
		var errMsg=eventInfo;
		window.my_map.centerAndZoom(new AliLatLng(39.90364,116.4121),15);
		CloudAPI.Utility.toast("获取当前位置出错："+errMsg);			
	}
};
//CloudAPI.Device.DeviceStateInfo.getCurrentPosition('getPositionSucceed', 'getPositionFailed');
callbackEventManager.getCurrentPosition(MapGetPositionResponse,true);